package br.com.mynage.dominio;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table (name="projeto")
public class Projeto {
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "geral_seq")
    @SequenceGenerator(name = "projeto_seq", sequenceName = "geral_seq")
	@Column(name="id")
	private Integer id;
	@OneToOne
	@JoinColumn(name="id_usuario_admin")
	private Usuario usuarioAdmin;
	@Column(name="nome")
	private String nome;
	@Column(name="descricao")
	private String descricao;
	@Column(name="data")
	private Date data;
	@ManyToMany (fetch = FetchType.EAGER)
	@JoinTable (name = "projeto_usuario",
				joinColumns = {@JoinColumn (name = "id_projeto")},
				inverseJoinColumns = {@JoinColumn (name = "id_usuario")})
	private List<Usuario> usuarios;
	
	public Projeto(){
		
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Usuario getUsuarioAdmin() {
		return usuarioAdmin;
	}

	public void setUsuarioAdmin(Usuario usuarioAdmin) {
		this.usuarioAdmin = usuarioAdmin;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public Date getData() {
		return data;
	}

	public void setData(Date data) {
		this.data = data;
	}

	public List<Usuario> getUsuarios() {
		return usuarios;
	}

	public void setUsuarios(List<Usuario> usuarios) {
		this.usuarios = usuarios;
	}

}
